package net.lab0.tools.evo;

import java.util.Comparator;

import net.lab0.tools.evo.iface.Individual;

public class FitnessComparator
implements Comparator<Individual<?>>
{
    @Override
    public int compare(Individual<?> o1, Individual<?> o2)
    {
        double fitness1 = o1.getFitness();
        double fitness2 = o2.getFitness();
        
        if (fitness1 > fitness2)
        {
            return 1;
        }
        else if (fitness1 < fitness2)
        {
            return -1;
        }
        else
        {
            return 0;
        }
    }
}
